<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    async function sleep(delay) {
        return new Promise(resolve => setTimeout(resolve, delay))
    }

    async function foo() {
        const start = Date.now();
        await sleep(1500)
        console.log(Date.now() - start)
    }
    foo(); // 1502
</script>
</body>
</html>